//Accepted
//http://livearchive.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=159
#include <cstdio>
#include <cstdlib>

int main(){
	int n,j,r;
	scanf("%d", &n);
	while(n--){
		r=0;
		scanf("%d", &j);
		while(j)r += j/=5;
		printf("%d\n", r);
	}
	
	return 0;
}
